# coding utf-8

# 组包 = 右边有多个数据时，会自动包装成为元组
_data = 10, 20, 30
print(_data, type(_data))

# 拆包
_data = (10, 20, 30)
a, b, c = _data
print(a, b, c)

# 使用组包与拆包交换俩个变量的值
a = 10
b = 20
a, b = b, a
print('a = %d,b = %d' % (a, b))
"""
原理
_tuple = b, a
a, b = _tuple
"""


# 函数返回多个值
def _test():
    return 10, 20, 30


_data = _test()
print(_data, type(_data))
a, b, c = _test()
print(a, b, c)


def _swap(_a: int, _b: int):
    temp = _a
    _a = _b
    _b = temp


_aa = 10
_bb = 20
_swap(_aa, _bb)
print('a = %d,b = %d' % (_aa, _bb))
